package com.me.forum.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.me.forum.domain.Notice;
import com.me.forum.request.NoticeRequest;
import com.me.forum.service.INoticeService;
import lombok.var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

@RestController
@RequestMapping("/notice")
public class NoticeController {
	
	@Autowired
	private INoticeService noticeService;
	
	/**
	 * @Description:获取所有公告
	 * @Author: Hao
	 * @Date: 2020/4/27 10:12
	 */
	@GetMapping
	public Object getAll(NoticeRequest nreq, String page, String size) {
		IPage<Notice> notices = noticeService.getAll(nreq, page, size);
		var map = new HashMap<String, Object>();
		map.put("success", notices != null);
		map.put("notices", notices);
		return map;
	}
}
